package com.pojoin.cms.domain.persistence;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.pojoin.cms.domain.Role;
import com.pojoin.cms.domain.alter.ResourceAlter;

@Entity
@Table(name = "resource")
public class ResourcePersistence extends ResourceAlter {

	@Override
	@Column
	public Date getCreateDate() {
		return super.getCreateDate();
	}

	@Override
	@Column
	public String getName() {
		return super.getName();
	}

	@Override
	@Column
	public String getPrivilegeCode() {
		return super.getPrivilegeCode();
	}

	@Override
	@Column
	public String getRemark() {
		return super.getRemark();
	}

	@Override
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getResourceId() {
		return super.getResourceId();
	}

	@Override
	@ManyToMany(mappedBy = "resources", targetEntity = RolePersistence.class, fetch = FetchType.EAGER)
	public Set<Role> getRoles() {
		return super.getRoles();
	}

	@Override
	@Column
	public String getTitle() {
		return super.getTitle();
	}
	
	public void setResourceId(Long id){
		this.resourceId = id;
	}

	@Override
	@Column
	public String getUrl() {
		return super.getUrl();
	}

	@Override
	@Column
	public Long getParentId() {
		return super.getParentId();
	}

}
